package com.common.orm.sqlparameters;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;

/**
 * @author Dmitry Savchenko
 */
public class ParameterDate extends SqlParameter {

    private Date value;

    public ParameterDate(String name, Date value) {
        super(name);
        this.value = value;
    }

    @Override
    public void process(int index, PreparedStatement prepStatement) throws SQLException {
        prepStatement.setDate(index, value==null?null:new java.sql.Date(value.getTime()));
    }
}
